package com.cloudlead.fleetAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.fleetAction.BusinessModules;
import com.cloudlead.fleetAction.service.FleetCostSer;
import com.cloudlead.fleetService.FleetCostService;
import com.cloudlead.fleetService.vo.BaseFleetCostVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;

@Controller
/**
 * Created by Will on 2015/12/17.
 */
public class FleetCostAcionFactory extends AbstractActionFactory implements FleetCostService {
    @Autowired
    FleetCostSer fleetCostSer;
    public FleetCostAcionFactory( ) {
        super(BusinessModules.FleetCost);
    }
    @Override
    @Action
    @Order(1)
    @Label("新增车队订单费用")
    public String addFleetCostService(BaseFleetCostVo baseFleetCostVo) {
        return fleetCostSer.addFleetCostService(baseFleetCostVo);
    }

    @Override
    @Action
    @Order(2)
    @Label("删除车队订单费用")
    public String delFleetCostService(@NotNull @Label("车队费用ID")String fleetCustomerId) {
        return fleetCostSer.delFleetCostService(fleetCustomerId);
    }

    @Override
    @Action
    @Order(3)
    @Label("编辑车队订单费用")
    public String editFleetCostService(BaseFleetCostVo baseFleetCostVo) {
        return fleetCostSer.editFleetCostService(baseFleetCostVo);
    }

    @Override
    @Action
    @Order(34)
    @Label("查询车队订单费用")
    public EasyuiGridData findAll(BaseFleetCostVo baseFleetCostVo,@NotNull @Label("每页记录条数") int rows, @NotNull @Label("页码")int page) {
        return new EasyuiGridData(fleetCostSer.findAll(baseFleetCostVo,rows,page),"id,baseFleetOrder.id orderId,calculateCount,contactCompany," +
                "costCode,costName,money,quantity,sort");
    }
}
